﻿/**
* Control de una galeria, Se encarga de leer el XML con la galeria
*/

import com.neshumah.Util.ObjectsList;
import com.gskinner.events.GDispatcher;
import com.gskinner.net.XML2;

// Clases relacionadas con imagenes

class com.neshumah.gallery.Gallery {
	var listado:ObjectsList;
	private var datos:XML2;
	var srcXML:String;
	
	
	
	// Event Dispatcher properties
	var addEventListener:Function;
	var removeEventListener:Function;
	var dispatchEvent:Function;
	
	function Gallery(src:String){
		this.srcXML=src;
		this.listado= new ObjectsList();
		GDispatcher.initialize(this);
		currentPercent=0;
	}
	
	function startLoad(){
		datos= new XML2();
		datos.ignoreWhite=true;
		// subscribe to its load event:
		datos.addEventListener("complete",this);
		// subscribe to its httpStatus event:
		datos.addEventListener("httpStatus",this);
		// set the timeout period to 20 seconds (default is 30 seconds):
		datos.timeout = 20000;
		// set the connection timeout period to 8 seconds (default is 6 seconds):
		datos.connectionTimeout = 8000;
		trace("read: "+this.srcXML);
		datos.load(this.srcXML);
	}
	
	// function to handle the load event:
	private function complete(p_evtObj:Object):Void {
		trace("success: "+p_evtObj.success);
		trace("status: "+p_evtObj.target.status);
	}
	// function to handle the httpStatus event:
	private function httpStatus(p_evtObj:Object):Void {
	  trace("http status: "+p_evtObj.httpStatus);
	}
	
	private function addE(e){
		
		this.listado.add(e);
	}
	
	function getList(){
		return this.listado;
	}
}